set(ALL_FILES all.cc indice.cc reordering.cc maxpool.cc nms.cc spconv_ops.cc pool_ops.cc)
if (SPCONV_BuildCUDA)
    set(ALL_FILES ${ALL_FILES} indice.cu reordering.cu maxpool.cu pillar_scatter.cu cublas_gemm.cc)
endif()
add_library(spconv SHARED ${ALL_FILES})

find_package(OpenMP)
if(OpenMP_CXX_FOUND)
    target_link_libraries(spconv PUBLIC OpenMP::OpenMP_CXX)
endif()


target_include_directories(spconv PRIVATE ${ALL_INCLUDE} )
set_property(TARGET spconv PROPERTY CUDA_STANDARD 14)
set_property(TARGET spconv PROPERTY CXX_STANDARD 14)
set_target_properties(spconv PROPERTIES CUDA_SEPARABLE_COMPILATION ON)
if (SPCONV_BuildCUDA)
    target_link_libraries(spconv PRIVATE ${ALL_LIBS} cuhash)
else()
    target_link_libraries(spconv PRIVATE ${ALL_LIBS})
endif()
install (TARGETS spconv DESTINATION lib)
